import '../item_style.dart';
import '../tooltip.dart';
import 'series.dart';

import 'package:json_annotation/json_annotation.dart';

part 'candlestick_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class CandlestickEmphasis {
  var focus;
  var blurScope;
  ItemStyle? itemStyle;

  CandlestickEmphasis({this.focus, this.blurScope, this.itemStyle});

  factory CandlestickEmphasis.fromJson(Map<String, dynamic> json) =>
      _$CandlestickEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$CandlestickEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class CandlestickBlurSelectEmphasis {
  ItemStyle? itemStyle;

  CandlestickBlurSelectEmphasis({this.itemStyle});

  factory CandlestickBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$CandlestickBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$CandlestickBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class CandlestickData {
  factory CandlestickData.fromJson(Map<String, dynamic> json) =>
      _$CandlestickDataFromJson(json);

  var name;

  var value;
  ItemStyle? itemStyle;

  CandlestickBlurSelectEmphasis? emphasis;
  CandlestickBlurSelectEmphasis? blur;
  CandlestickBlurSelectEmphasis? select;

  Tooltip? tooltip;

  CandlestickData(
      {this.name,
      this.value,
      this.itemStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.tooltip});

  Map<String, dynamic> toJson() => _$CandlestickDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class CandlestickSeries extends Series {
  var id;
  var type = 'candlestick';
  var coordinateSystem;
  var xAxisIndex;
  var yAxisIndex;
  var name;
  var legendHoverLink;
  var hoverAnimation;
  var layout;
  var barWidth;

  var barMinWidth;
  var barMaxWidth;
  ItemStyle? itemStyle;

  CandlestickEmphasis? emphasis;

  CandlestickBlurSelectEmphasis? blur;

  CandlestickBlurSelectEmphasis? select;

  var selectedMode;
  var large;
  var largeThreshold;
  var progressive;
  var progressiveThreshold;
  var progressiveChunkMode;
  var dimensions;
  var encode;
  List<CandlestickData>? data;

  MarkPoint? markPoint;
  MarkLine? markLine;
  MarkArea? markArea;

  var clip;
  var zlevel;
  var z;
  var silent;
  var animationDuration;
  var animationEasing;
  var animationDelay;
  Tooltip? tooltip;

  CandlestickSeries(
      {this.id,
      this.coordinateSystem,
      this.xAxisIndex,
      this.yAxisIndex,
      this.name,
      this.legendHoverLink,
      this.hoverAnimation,
      this.layout,
      this.barWidth,
      this.barMinWidth,
      this.barMaxWidth,
      this.itemStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.selectedMode,
      this.large,
      this.largeThreshold,
      this.progressive,
      this.progressiveThreshold,
      this.progressiveChunkMode,
      this.dimensions,
      this.encode,
      this.data,
      this.markPoint,
      this.markLine,
      this.markArea,
      this.clip,
      this.zlevel,
      this.z,
      this.silent,
      this.animationDuration,
      this.animationEasing,
      this.animationDelay,
      this.tooltip});

  factory CandlestickSeries.fromJson(Map<String, dynamic> json) =>
      _$CandlestickSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$CandlestickSeriesToJson(this);
}
